Fix crash when evaluating "(signal nil 5)" (bug#78738)
authorPip Cet <pipcet@protonmail.com>
Tue, 10 Jun 2025 12:00:30 +0000 (12:00 +0000)
committerPip Cet <pipcet@protonmail.com>
Tue, 10 Jun 2025 12:00:30 +0000 (12:00 +0000)
The docstring already warns against calling signal with a nil
error symbol, which is for internal use only, but we can avoid crashing
in this case.

* src/eval.c (Fsignal): Produce a "peculiar error" for more arguments
involving non-lists.

src/eval.c

index caae4cb17e28158d067453a6cf309a8464aee5cc..ecff5d40a10b7a82eab4444deef67fc38602d516 100644 (file)
@@ -1817,7 +1817,7 @@ See also the function `condition-case'.  */
   (Lisp_Object error_symbol, Lisp_Object data)
 {
   /* If they call us with nonsensical arguments, produce "peculiar error".  */
-  if (NILP (error_symbol) && NILP (data))
+  if (NILP (error_symbol) && !CONSP (data))
     error_symbol = Qerror;
   signal_or_quit (error_symbol, data, false);
   eassume (false);